package com.example.yu.customview_color;

import android.content.Context;
import android.support.v7.widget.AppCompatTextView;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;

public class MyTextView extends AppCompatTextView {
    private static final String TAG = "SB";
    public MyTextView(Context context) {
        super(context);
    }

    public MyTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    /**
     * 事件分发
     * @param event
     * @return  表示终止整条事件链 的传递， false：与 super。dispatchtouchevient 效果一样， 继续传递
     */
    @Override
    public boolean dispatchTouchEvent(MotionEvent event) {
        Log.i(TAG, "dispatchTouchEvent: "+getTag());

        return super.dispatchTouchEvent(event);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        Log.i(TAG, "onTouchEvent: "+getTag());


        return super.onTouchEvent(event);
    }
}
